﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BoYuan.MvcCodeTemplates.DBMappingRules
{
    /// <summary>
    /// 数据类型对应规则
    /// </summary>
    public class DataTypeMapping
    {
        public class Mssql
        {
            public static Dictionary<string, string> GetBaseDataType()
            {
                Dictionary<string, string> dic = new Dictionary<string, string>();
                //数据库                  C#  
                dic["int"]              = "System.Int32";
                dic["text"]             = "System.String";
                dic["bigint"]           = "System.Int64";
                dic["binary"]           = "System.Byte[]";
                dic["bit"]              = "System.Boolean";
                dic["char"]             = "System.String";
                dic["datetime"]         = "System.DateTime";
                dic["decimal"]          = "System.Decimal";
                dic["float"]            = "System.Double";
                dic["image"]            = "System.Byte[]";
                dic["money"]            = "System.Decimal";
                dic["nchar"]            = "System.String";
                dic["ntext"]            = "System.String";
                dic["numeric"]          = "System.Decimal";
                dic["nvarchar"]         = "System.String";
                dic["real"]             = "System.Single";
                dic["smalldatetime"]    = "System.DateTime";
                dic["smallint"]         = "System.Int16";
                dic["smallmoney"]       = "System.Decimal";
                dic["timestamp"]        = "System.DateTime";
                dic["tinyint"]          = "System.Byte";
                dic["uniqueidentifier"] = "System.Guid";
                dic["varbinary"]        = "System.Byte[]";
                dic["varchar"]          = "System.String";
                dic["variant"]          = "System.Object";
                return dic;
            }
        }
    }
}
/* //创建 测试类型的sql

 CREATE TABLE [dbo].[tb](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[title] [nvarchar](100) NOT NULL,
	[realCol] [real] NULL,
	[floatCol] [float] NULL,
	[datetimeCol] [datetime] NULL,
	[tinyintCol] [tinyint] NULL,
	[nvarcharCol] [nvarchar](100) NULL,
	[bigintCol] [bigint] NULL,
	[decimalCol] [decimal](18, 0) NULL,
	[moneyCol] [money] NULL,
	[smallintCol] [smallint] NULL,
	[bitCol] [bit] NULL,
 CONSTRAINT [PK_tb] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

 */
